<template>
	<view>
		<view :class="'gui-card-view gui-margin-top gui-box-shadow gui-border-radius gui-padding gui-bg-white'"
			v-for="(item,index) in jf_shop" :key="index">
			<view class="gui-card-body gui-flex gui-rows gui-nowrap" style="padding-top: 20rpx;">
				<image :src="item.coupon.img" class="gui-card-img"
					style="position: relative;top:10rpx;width: 160rpx;height:160rpx;"></image>
				<view class="gui-card-desc ">
					<view class="" style="">
						<view class="gui-h4 gui-text-left" style="color:#666666;height: 80rpx;">
							{{item.coupon.name}}
						</view>
						<view class="gui-flex gui-space-between gui-color-red gui-h4" style="line-height: 40rpx;">
							<view>
								积分：{{item.coupon.price}}
							</view>
							<view>
								数量：{{item.num}}
							</view>
						</view>
						<view class="gui-flex gui-space-between">
							<view>
								<view>
									下单时间：{{item.created_at.split(' ')[0]}}
								</view>
								<view>
									结束时间：{{item.out_time.split(' ')[0]}}
								</view>
							</view>
							<view>
								<view v-if="item.status==0" class="gui-text-right "
									@tap="get_coupon_code(item.coupon.id,item.coupon.code,item.id,item.coupon.star_time,item.coupon.end_time)">
									<button size="mini" type="primary">二维码</button>
		
								</view>
								<view v-else>
									已使用
								</view>
							</view>
						</view>
					</view>
					<view style="margin-top: 10rpx;">
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				jf_shop:[],
				user:uni.getStorageSync("member")
			}
		},
		methods: {
			get_goods() {
				let self = this;
				console.log('-1---')
				this.$boya.NPost("/app/card_bag/get_all_coupon", {
					user_id: self.user.id,
					type: self.card_cut,
					idNo: self.user.idNo
				}, function(res) {
					if (res.data.length == 0) {
						self.isEmpty = true
					} else {
						self.isEmpty = false
					}
					switch (self.card_cut) {
						case "1":
							self.products2 = res.data;
							break;
						case "2":
							self.jf_shop = res.data;
							break;
					}
					console.log('优惠券: ', res.data);
				});
			},
		}
	}
</script>

<style>

</style>
